package impl

type StockIndexMonthDaoImpl struct {
	*BaseDaoImpl
}

// 返回dao实现类
func GetStockIndexMonthDaoImpl() *StockIndexMonthDaoImpl {
	return &StockIndexMonthDaoImpl{GetBaseDaoImpl()}
}

// 返回表名
func (s *StockIndexMonthDaoImpl) FindTableName() string {
	return "STOCK_INDEX_MONTH"
}

// 根据begin_date，计算记录数
func (s *StockIndexMonthDaoImpl) CountByBeginDate(transactionDate string) int {
	var stockNumber int
	s.db.Raw("select count(*) from stock_index_month t where t.begin_date=to_date(?,'yyyy-mm-dd')", transactionDate).Scan(&stockNumber)
	return stockNumber
}

// 根据end_date，计算记录数
func (s *StockIndexMonthDaoImpl) CountByEndDate(transactionDate string) int {
	var stockNumber int
	s.db.Raw("select count(*) from stock_index_month t where t.end_date=to_date(?,'yyyy-mm-dd')", transactionDate).Scan(&stockNumber)
	return stockNumber
}
